#define _CRT_SECURE_NO_WARNINGS 
#include <stdio.h>

int main() {
    int n, max, min;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        int s;
        scanf("%d", &s);
        if (i == 0)
            max = min = s;
        if (s > max)
            max = s;
        if (s < min)
            min = s;
    }
    printf("%d", max - min);
    return 0;
}